<% layout('/layouts/default.html', {title: 'edu_teacher_state管理', libs: ['validate']}){ %>
<div class="main-content">
	<div class="box box-main">
		
		<#form:form id="inputForm" model="${eduTeacherState}" action="${ctx}/edu/eduTeacherState/save" method="post" class="form-horizontal">
		<#form:hidden path="user.userCode" maxlength="64" class="form-control required"/>
								<#form:hidden path="state" maxlength="10" class="form-control"/>
			<div class="box-body">
				
				<#form:hidden path="teacherCode"/>
				
				<!-- <div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('选择地区')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								
								<#form:treeselect id="parent" title="上级区域"
									path="area.areaCode" labelName="area.areaName" labelValue="${eduTeacherState.area.areaName!}"
									url="${ctx}/sys/area/treeData" returnFullName="true"
									class="required" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
							</div>
						</div>
					</div>
				</div> -->
				<div class="row" id="school_title">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('选择学校')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:treeselect id="company" title="${text('调入院校')}"
									path="employee.company.companyCode"
									labelPath="employee.company.companyName" 
									callbackFuncName="companyCallback" url="${ctx}/sys/office/treeData?isAll=true"
									btnClass="" allowClear="true" />
				
							</div>
						</div>
					</div>
					</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('操作主题')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:input path="title" maxlength="500" class="form-control required" />
								<i class="fa icon-question ">调出请不要修改学校信息</i>
							</div>
						</div>
					</div>
					</div>
					<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('联系电话')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:input path="contact" maxlength="200" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('备注信息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<% if (hasPermi('edu:eduTeacherState:edit')){ %>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
			<% } %>
		</#form:form>
	</div>
</div>
<% } %>
<script>

$(document).ready(function(){
	var state = GetQueryString('state');
	$("#school_title").hide();
	if(state=='01'||state=='05'){
		$("#school_title").show();
	}
})


function companyCallback(id, act, index, layero, nodes){

	if (act == 'ok'&&nodes.length>0){
		var selectData = nodes[0];
		$("#title").val(selectData.name);
	}
}

function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}

$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});

function GetValue(){
	$("#inputForm").submit();
	if($("#title").val()==""){
		return "请填写主题";
	}
	if($("#contact").val()==""){
		return "请填写联系方式";
	}
	
	return "ok";
}
</script>